<?php
// +----------------------------------------------------------------------
// | makePHP 
// +----------------------------------------------------------------------
// | Copyright (c) 2009 http://makephp.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed BSD.(http://www.make.org/BSD-license.txt)
// +----------------------------------------------------------------------
// | Author: 叁石(sanshi) <sanshi0815@tom.com>
// | Author: 白家昌<baijc2004cn@126.com>
// +----------------------------------------------------------------------
/**
 * shot_user Database of the driver class.
 *
 * @Author:    <upsetcn@gmail.com>slash
 * @Package:   Database Operate class of the system.
 * @Copyright: Copyright (c) 2005 - 2006 
 * @Version:   $Id: DB_shot_user.class.php 2010-04-20 15:41:10 $
 * @Show Note: 用户模块
 */
/* @Package of the database class */
Class DB_shot_user extends PdoMysql
{
    /* Mysql Table Name */
    public $tableName = "shot_user";

    /**
     * Construction this Database Object.
     *
     * @Author: slash.
     * @Show: Get the PdoMysql Object and Set the default Charset.
     * @Return: ..
     */
    public function __construct()
    {
    		parent::__construct();
    }

    /**
     * Execute the insert method.
     *
     * @Author: slash.
     * @Show: Execute 'insert' method by the PdoMysql Object.
     * @Param: $values Array -- Key is the Table Coulnum and Value is that values.
     * @Return: False OR int.
     */
    public function insert_shot_user($values)
    {
        return $this->insert($this->tableName, $values);
    }

    /**
     * Execute the update method.
     *
     * @Author: slash.
     * @Show: Execute 'update' method by the PdoMysql Object.
     * @Param: $values Array -- Key is the Table Coulnum and Value is that values.
     * @Param: @where  Array -- Key is the Table Coulnum and Value is the where values.
     * @Return: False OR int.
     */
    public function update_shot_user($values, $where)
    {
        return $this->update($this->tableName, $values, $where);
    }
    
    /**
     * Execute the delete method.
     *
     * @Author: slash.
     * @Show: Execute 'delete' method by the PdoMysql Object.
     * @Param: @where  Array -- Key is the Table Coulnum and Value is the where values.
     * @Return: False OR int.
     */
    public function delete_shot_user($where)
    {
        return $this->delete($this->tableName, $where);
    }

    /**
     * Execute the select method.
     *
     * @Author: slash
     * @Show: Execute 'select' method by the PdoMysql Object, Return the item set.
     * @Param: $where String -- Search where.
     * @Param: $col String -- Search Order.
     * @Param: $numrows Int -- Search item num.
     * @Param: $offset Int -- Search item set offset.
     * @Param: $field String -- Search item name.
     * @Return: False OR Array.
     */
    public function getAll($where='1', $col='', $numrows=-1, $offset=-1, $field="*")
    {
        $sql = sprintf("SELECT %s FROM %s WHERE %s", $field, $this->tableName, $where);
        return $this->select($sql, $col, $numrows, $offset);
    }

    /**
     * Get one Item.
     *
     * @Author: slash
     * @Show: Search the database.Return one item.
     * @Param: $index Array -- Key is the index Key.Value is the index value.
     * @Return: Array.
     */
    public function getOne($user_id)
    {
        $sql = sprintf("SELECT * FROM %s WHERE user_id = '%s'", $this->tableName, $user_id);
        $result = $this->select($sql, 'user_id', 1, 0);
        return isset($result[0]) ? $result[0] : array();
    }
    
}

/* Public function is the Class method, Design by Hooker framework designer */
/* CreateTime: 2010-04-20 15:41:10 */

?>